<%--
  Created by IntelliJ IDEA.
  User: Black
  Date: 2016/3/17
  Time: 9:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <!-- 引入 echarts.js -->
    <c:set var="ctx" value="${pageContext.request.contextPath}" /> 
    <script src="${pageContext.request.contextPath}/resources/js/jquery-1.11.1.js"></script>
    <script src="${pageContext.request.contextPath}/resources/js/echarts.common.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
   
	var url ="/MvnTest/student/info";
    names = [];
	
	
   // 基于准备好的dom，初始化echarts实例
   var myChart = echarts.init(document.getElementById('main'));
   // 指定图表的配置项和数据
   var option = {
       title: {
           text: '学生成绩列表'
       },
       tooltip: {},
       legend: {
           data:['成绩']
       },
       xAxis: {
           data: names
       },
       
       yAxis: {},
       series: [{
           name: '成绩',
           type: 'bar',
           data: [99, 20, 36, 10, 10, 20]
       }]
   };
   
   // 使用刚指定的配置项和数据显示图表。
   myChart.setOption(option);
   
   $.getJSON(url,function(json){
	   names = json.names;
	   	option = {
	   	       xAxis: {
	   	           data: names
	   	       },
	   	       series: [{
	   	           name: '成绩',
	   	           type: 'bar',
	   	           data: [99, 20, 36, 10, 10, 20]
	   	       }]
	   	   };
	   	myChart.setOption(option);
	});
	    
</script>

</body>
</html>
